package pers.sen.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import pers.sen.health.po.CheckGroup;
import pers.sen.health.po.CheckItem;
import pers.sen.health.po.Setmeal;
import pers.sen.health.vo.CheckGroupVO;
import pers.sen.health.vo.SetmealVO;

import java.util.List;

/**
 * @author Jason
 * @version 1.0.0
 * @date 2020/11/5 9:05
 * @Description TODO
 */
public interface SetMealMapper extends BaseMapper<Setmeal> {
    @Insert("insert into t_setmeal_checkgroup values (#{sid},#{checkgroupId})")
    void insertInfoByGid(@Param("sid") Integer sid, @Param("checkgroupId") Integer checkgroupId);

    @Select("select NAME,REMARK,SEX,AGE,IMG from t_setmeal where ID = #{id}")
    SetmealVO findSetMealById(@Param("id") int id);

    @Select("select tc.ID, tc.NAME,tc.REMARK from t_setmeal_checkgroup tsc , t_checkgroup tc where tsc.CHECKGROUP_ID = tc.ID and tsc.SETMEAL_ID = #{id}")
    List<CheckGroupVO> findCheckGroupInfoBySid(@Param("id") int id);

    @Select("select tc.NAME from  t_checkgroup_checkitem tcc , t_checkitem tc where tcc.CHECKITEM_ID = tc.ID and tcc.CHECKGROUP_ID = #{id}")
    List<CheckItem> findCheckItemByCid(@Param("id") Integer id);


//    @Insert("insert into t_checkgroup_checkitem values (#{gId},#{cId})")
//    Boolean insertInfoByGid(@Param("gId") Integer gId, @Param("cId") Integer cId);
//
//    @Select("select CHECKITEM_ID from t_checkgroup_checkitem where CHECKGROUP_ID = #{id}")
//    Integer[] findCheckItemInfoByGroupId(@Param("id") int id);
//
//    @Delete("delete from t_checkgroup_checkitem where checkgroup_id = #{checkGroupDTOId}")
//    Boolean deleteCheckItemInfoByGId(@Param("checkGroupDTOId") int checkGroupDTOId);
}
